package jd.se.updatepw;

import jd.se.common.Utils;
import jd.se.findpw.FindDto;
import jd.se.findpw.FindpwDao;
import org.apache.ibatis.session.SqlSession;

public class updatepwSer {
    public boolean updatepw(updatepwDto dto){
        SqlSession sqlSession = Utils.openSession();
        try{
            updatepwDao dao = sqlSession.getMapper(updatepwDao.class);
            int n = dao.updatepw(dto);//update user set password=#{password} where u_id = #{u_id}
            sqlSession.commit();
            return n>0;
        }catch (Exception e){
            sqlSession.rollback();
            throw new RuntimeException(e);
        }finally {
            sqlSession.close();
        }
    }
}
